Enable the language switcher for the French edition - #21
Merged
Conversation
Mirrors QuantEcon/lecture-python-programming#490, which adds the same block to the English source. Lists all four editions with current_language set to fr so this edition renders as active, and injects the hreflang alternates for the set. English stays first in the list because the theme uses languages[0] as the hreflang x-default target. Verified with a local build against the theme: the switcher lists all four languages with fr active. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR enables the QuantEcon book theme language switcher for the French edition by adding the languages list and current_language configuration under sphinx.config.html_theme_options in lectures/_config.yml, aligning the French site with the upstream pattern described in the PR metadata.
Changes:
- Add
html_theme_options.languageswith entries foren,fa,fr, andzh-cn. - Set
html_theme_options.current_language: frso the French site is marked active in the switcher.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📖 Netlify Preview Ready!Preview URL: https://pr-21--verdant-toffee-3261a8.netlify.app Commit: Build Info
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Adds the language switcher configuration to
html_theme_optionsinlectures/_config.yml, mirroring QuantEcon/lecture-python-programming#490 which adds the same block to the English source.enfafrzh-cnEnglish stays first because the theme uses
languages[0]as thehreflangx-defaulttarget.Why this is a separate PR
The switcher does not propagate from the English source. The sync workflows trigger only on
lectures/**/*.mdandlectures/_toc.yml, so_config.ymlnever reaches a sync run — and sync carries lecture content, not site config. Each edition also needs its owncurrent_language, so a verbatim copy would be wrong regardless. Hence one small PR per edition.Verification
Built locally against the theme with this file's
html_theme_options: the switcher lists all four languages with Français active, and thehreflangalternates inject includingx-default→ en.No environment change needed — this repo already pins
quantecon-book-theme==0.21.0, which provides the switcher.This is the only one of the three translated editions whose
html.baseurland emitted canonical URL are already correct —https://quantecon.github.io/lecture-python-programming.fr/, matching where the site actually serves — so thehreflanghalf works here as intended. The.faand.zh-cnPRs both carry a caveat on this point.